package com.wjk.kylin.mall.admin.service.impl;

import com.wjk.kylin.mall.admin.entity.RoleMenuEntity;
import com.wjk.kylin.mall.admin.mapper.RoleMenuMapper;
import com.wjk.kylin.mall.admin.service.IRoleMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjk.kylin.mall.common.core.dto.admin.MenuComponentInDTO;
import com.wjk.kylin.mall.common.core.dto.base.DataOutDTO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 角色和菜单关联表 服务实现类
 * </p>
 *
 * @author wangjinkui
 * @since 2021-11-14
 */
@Service
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenuEntity> implements IRoleMenuService {

    /**
     * 根据访问路径查询角色
     *
     * @param inDTO
     * @return
     */
    @Override
    public DataOutDTO<Object> getRoleIdByComponent(MenuComponentInDTO inDTO) {
        List<Long> list = baseMapper.getRoleIdByComponent(inDTO.getComponent());
        return DataOutDTO.builder().data(list).build();
    }
}
